package haiyangwangwork.day01.homework;

public class Army {
    Soldier[] soldiers;

    public Army(){
        soldiers=new Soldier[10];
    }
    public void addSoldier(Soldier soldier, int i) {
        if (i<soldiers.length){
            soldiers[i]=soldier;
        }
    }
    public void listAllSoldier(){
        String name="";
        String job="";
        String skill="";
        for (int i=0;i<soldiers.length;i++){
            name=soldiers[i].soldierName;
            job=soldiers[i].soldierJob;
            skill=soldiers[i].soldierSkill;
            System.out.println("职务为："+job+"的"+name+"的技能是"+skill);
            soldiers[i].skill();
    }
    }
}
